<template>
  <div id="app">
    <!-- 活动组件 -->
    <van-row class="goodslist">
      <van-col class="goods" v-for="(goods,index) in goods_list" :key='goods.goods_id' span="12">
        <div class="goods_thumb"><img v-lazy="goods.goods_image" name="adapter" @click.stop="redirect('/goods/id_'+goods.goods_id)" /></div>
        <h4 class="goods_name" @click.stop="redirect('/goods/id_'+goods.goods_id)">{{goods.goods_name}}</h4>
      </van-col>
    </van-row>
  </div>
</template>

<script>
  import { mapState,mapActions,mapGetters } from 'vuex';
  export default {
    components:{
    },
    name: 'goodsList',
    data() {
      return {
        goods_list:[],
      }
    },
    props:{
      cateID:{
        type:Number,
        required:true,
        default(){
          return {
            cateID: 0
          }
        }
      },

    },
    computed: {
    },
    methods: {
      // 瀑布流方法
      loadMore() {
        this.disabled = true;
        setTimeout(() => {
          for (let i = 0; i < 10; i++) {
            this.imageList.push(this.imageList[i]);
          }
          this.disabled = false;
        }, 200);
      },
      redirect(url){
        console.log(url);
        this.$router.push(url);
      },
    },
    watch: {

    },
    beforeCreate() {

    },
    created() {
      this.$fetch("/index/getGoodsList/cate_id/"+this.cateID).then((res)=>{
        if(res.code == 1){
          this.goods_list = res.data.goods_list
        }
      });
    }
  }
</script>

<style lang="less" scoped>
  @import url('../assets/css/home.less');
</style>

